<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #box{
            font-weight: bold;
            font-size: 20px;
            width: 10px;
            margin: 10px auto;
        }
    </style>
</head>
<body>
    <div id="box">1</div>
    <script>
        window.onload = function(){
            var box = document.getElementById('box')
            var i = 1
            setInterval(() => {
                box.innerText = i++
                // document.write(i++)     
                console.log(1);           
            }, 2000);
        }
    </script>
</body>
</html>